/*
 * hmc5883_support.h
 *
 *  Created on: Feb 28, 2013
 *      Author: Kurt Hardin
 */

#ifndef HMC5883_SUPPORT_H_
#define HMC5883_SUPPORT_H_

#include "MagData.h"

#define HMC5883_BASE_ADDR	0x1E
#define	HMC5883_CTRL_WR		0x3C
#define	HMC5883_CTRL_RD		0x3D

#define HMC5883_REG_CONF_A  0x00
#define HMC5883_REG_CONF_B  0x01
#define HMC5883_REG_MODE    0x02
#define HMC5883_REG_X_HSB	0x03
#define HMC5883_REG_X_LSB	0x04
#define HMC5883_REG_Z_HSB	0x05
#define HMC5883_REG_Z_LSB	0x06
#define HMC5883_REG_Y_HSB	0x07
#define HMC5883_REG_Y_LSB	0x08
#define HMC5883_REG_STATUS  0x09
#define HMC5883_REG_ID_A    0x0A
#define HMC5883_REG_ID_B    0x0B
#define HMC5883_REG_ID_C    0x0C

// MCF52233 <-> HMC5883 I2C Utility functions
void hmc5883_read_all(MagData *);
int16 hmc5883_read_axis(uint8);
void hmc5883_write(uint8, uint8);

#endif /* HMC5883_SUPPORT_H_ */
